package array

import (
	"fmt"
)
//数组是值类型
func printArray(arr [5]int)  {
	arr[0] = 100
	for i,v :=range arr  {
		fmt.Println(i,v)
	}
}

func printArrayP(arr *[5]int)  {
	arr[0] = 100
	for i,v :=range arr  {
		fmt.Println(i,v)
	}
}


func main() {
	var arr1 [5]int
	arr2 :=[3]int{1,2,5}
	arr3 :=[...]int{1,2,5,8,9}
	fmt.Println(arr1,arr2,arr3)
	fmt.Println("printArray arr1")

	printArray(arr1)
	fmt.Println("printArray arr3")

	printArray(arr3)
	fmt.Println("printArray arr1  arr3")

	fmt.Println(arr1,arr3)



	fmt.Println("printArray arr1")

	printArrayP(&arr1)
	fmt.Println("printArray arr3")

	printArrayP(&arr3)
	fmt.Println("printArray arr1  arr3")

	fmt.Println(arr1,arr3)

}
